/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.viajaconmigo.web.controladores.util;

import java.util.ResourceBundle;
import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;

/**
 *
 * @author Jose Manuel
 */
public class JSFUtil {

    public static void createMessageError(String place, String keyMessage) {
        FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR,
                getBundle().getString(keyMessage), getBundle().getString(keyMessage));
        FacesContext.getCurrentInstance().addMessage(place, message);
    }

    public static ResourceBundle getBundle() {
        return FacesContext.getCurrentInstance().getApplication().getResourceBundle(FacesContext.getCurrentInstance(), "msg");
    }
}
